IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'SettingUpdate')
	BEGIN
		DROP  Procedure  SettingUpdate
	END

GO

CREATE Procedure SettingUpdate
(
	@key nvarchar(50),
	@value nvarchar(50)
)
AS

IF NOT EXISTS(SELECT * FROM Settings WHERE SettingKey = @key)
BEGIN
	INSERT INTO Settings (SettingKey, SettingValue) VALUES (@key, @value)
END
ELSE
BEGIN
	UPDATE Settings SET SettingValue = @value WHERE SettingKey = @key
END

GO